<?php

use Hyperf\Database\Schema\Schema;
use Hyperf\Database\Schema\Blueprint;
use Hyperf\Database\Migrations\Migration;

class CreateStatDailyHostInfoTable extends Migration
{
    protected $connection = 'stat';

    /**
     * Run the migrations.
     */
    public function up(): void
    {
        Schema::create('stat_daily_host_info', function (Blueprint $table) {
            $table->increments('id');
            $table->date('dt')->comment('统计日期');
            $table->integer('user_id')->default(0)->comment('主播ID');
            $table->double('income_total', 10, 1)->default(0.0)->comment('总收入');
            $table->double('income_gift', 10, 1)->default(0.0)->comment('普通礼物收入');
            $table->double('income_msg', 10, 1)->default(0.0)->comment('私信收入');
            $table->double('income_voice', 10, 1)->default(0.0)->comment('语音收入');
            $table->double('income_video', 10, 1)->default(0.0)->comment('视频收入');
            $table->double('income_sysgift', 10, 1)->default(0.0)->comment('名义系统礼物收入');
            $table->timestamps();
            $table->tinyInteger('flag')->default(1)->comment('记录状态');
            $table->index('dt', 'dt');
            $table->index('user_id', 'user_id');
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::dropIfExists('stat_daily_host_info');
    }
}
